package com.itheima;

import com.itheima.dao.BookDao;
import com.itheima.dao.impl.BoodDaoImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;

/**
 * @author げっしょく
 * @date 2021/9/12
 */
public class App {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
//        Object b1 = ctx.getBean("b1");
//        BookDao b2 = (BoodDaoImpl) ctx.getBean("b2");
//        b2.save();
//        System.out.println(b2);
//        System.out.println(b1);
        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
        bookDao.save();
        System.out.println(bookDao);
/*

        DataSource dataSource = (DataSource) ctx.getBean("dataSource");

        System.out.println(dataSource);*/

//        BookDao bookDao = (BookDao) ctx.getBean("bookDao");

//        bookDao.save();

//        BookDao bean = ctx.getBean(BookDao.class);
//
//        bean.save();

    }
}
